# Maintainer: Jiachen YANG <farseerfc@gmail.com>
# Contributor: Henrik Hodne <henrik@hodne.io>
# Contributor: Ariel AxionL <axionl@aosc.io>
# AUR Maintainer: Stefan Husmann <stefan-husmann@t-online.de>

pkgbase=fira-code
pkgname=('ttf-fira-code' 'woff-fira-code' 'woff2-fira-code')
pkgver=6.2
pkgrel=2
pkgdesc="Monospaced font with programming ligatures"
arch=('any')
url='https://github.com/tonsky/FiraCode'
license=('custom:OFL')
depends=()
source=("$pkgbase-$pkgver.zip::https://github.com/tonsky/FiraCode/releases/download/${pkgver}/Fira_Code_v${pkgver}.zip"
        "LICENSE::https://raw.githubusercontent.com/tonsky/FiraCode/${pkgver}/LICENSE")
sha512sums=('7f71b34cce960bb5b90165505214d9effa7aa0b9e3ae3a7da37b900db54adbb30d1ff4b44f77c88fe0c7ddef45fc17ac6f05f08745fd26e1a298eeb61e6fddd3'
            'bee6615aa2c8771ea9685a6de630eceb554c22920fd56379be460f461b27081de2d12e04298e4aecc76b733465730f3f3b602867abbc2df53105eb8ccf5475d2')

function _package {
    local ext="${1%%-*}"
    cd "$ext"
    local fonts=(FiraCode*."$ext")
    local installdir="${ext^^}"

    # Prepare destination directory
    install -dm755 "$pkgdir/usr/share/fonts/$installdir"

    # Install fonts
    local font
    for font in "${fonts[@]}"; do
        install -m644 "$font" "$pkgdir/usr/share/fonts/$installdir"
    done

    # Install LICENSE
    install -Dm644 "$srcdir/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

for _pkgname in ${pkgname[@]}; do
    eval "function package_$_pkgname() { _package $_pkgname; }"
done

# vim:set ts=8 sw=4 et:
